package com.example.auth.entity.dto;

import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.ObjectUtil;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;


import java.util.Date;

/**
 * @author: LiYang
 * @create: 2023-07-10 17:35
 * @Description:
 * @Version 1.0
 **/
@Data
public class SysUserQueryDTO {

    private String username;

    private String name;

    private Integer status;

    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private Date beginTime;
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private Date endTime;

    public void setBeginTime(Date beginTime) {
        if (ObjectUtil.isNull(beginTime)){
            this.beginTime = beginTime;
        }else {
            this.beginTime = DateUtil.beginOfDay(beginTime);
        }

    }

    public void setEndTime(Date endTime) {
        if (ObjectUtil.isNull(endTime)){
            this.endTime = endTime;
        }else {
            this.endTime = DateUtil.endOfDay(endTime);
        }

    }
}
